# directions/moves
UP    = 0
RIGHT = 1
DOWN  = 2
LEFT  = 3

STRAIGHT = 0

RELMOVES  = [STRAIGHT, RIGHT, LEFT]
MOVES     = [UP, RIGHT, DOWN, LEFT]
MOVESTRS  = ["UP", "RIGHT", "DOWN", "LEFT"]
RMOVESTRS = ["STRAIGHT", "RIGHT", "NONE", "LEFT"]

# converts relative direction (LEFT, RIGHT, STRAIGHT) into absolute (UP, RIGHT, DOWN, LEFT)
convertDirection = lambda baseDir: lambda relDir: (baseDir + relDir) % 4

# first coord - columns - horizontal axis - x
# second coord - rows - vertical axis - y
MOVEMODS = {UP: (0, -1), RIGHT: (+1, 0), DOWN: (0, +1), LEFT: (-1, 0)}

# grid tile symbols
EMPTY = '.'
WALL  = '#'
# snakes are denoted '0', '1', '2', ...

XRES = 800
YRES = 700

# grid size
DIMX = 20
DIMY = 20

TILESIZE = 5

# colors
BGTILECOLOR = [65, 65, 145]
BGLINECOLOR = [114, 117, 172]
WALLCOLOR   = [0, 0, 0]

# position on grid -> position on screen
OFFSETX = (XRES/2 - DIMX * 3 - 1) - (XRES/2 - DIMX * 3 - 1) % 6 + 1
OFFSETY = (YRES/2 - DIMY * 3 - 1) - (YRES/2 - DIMY * 3 - 1) % 6 + 1
posInPixels = lambda k: (6*k[0] + OFFSETX, 6*k[1] + OFFSETY)

# adds/subs two tuples/lists as vectors
addZip = lambda l1: lambda l2: tuple([l1[i] + l2[i] for i in xrange(len(l1))])
subZip = lambda l1: lambda l2: tuple([l1[i] - l2[i] for i in xrange(len(l1))])
